package com.fjeld.client.gui.control.navigation;

import com.fjeld.client.gui.screens.node.MessagesView;
import com.fjeld.swingx.JTransparentPanel;
import com.fjeld.client.gui.screens.*;
import com.fjeld.client.gui.screens.node.ActionCommandsView;
import com.fjeld.client.gui.screens.node.ServerFarmView;
import com.fjeld.client.gui.screens.tabbed.ManagementTab;

import javax.swing.*;
import java.util.ArrayList;
import java.util.List;

/**
 * A class representing the various states the program can be in.
 */
public enum NavigationEnum
{
    MANAGEMENT_TAB_CONTAINER("Management", "Management", "Home"),
    ACTION_TAB_CONTAINER("Blueprint", "Blueprint", "Home"),
    MANAGEMENT_VIEW("Servers detected", "Servers detected", "Home"),
    MESSAGES_VIEW("Messages", "Messages", "email"),
    ACTION_VIEW("Home", "Home", "Home"),
    ACTION_EDIT("Edit action", "Edit action", "Edit"),
    ACTION_EXECUTION("Execution", "Execution History", "Execution"),
    EMAIL_ME("Email", "Report errors or faults", "email"),
    DONATE("Donate", "Donations", "Donate"),
    ADD("Add", "Add", "Add"),
    REMOVE("Remove", "Remove", "Remove"),
    REMOVE_IMAGE("RemoveImage", "", "RemoveImage"),
    REMOVE_MINI("RemoveMini", "", "Remove");

    private String enumID;
    private String displayName;
    private String iconName;
    private JPanel contentPanel = new JTransparentPanel();

    NavigationEnum(String enumID, String displayName, String iconName)
    {
        this.enumID = enumID;
        this.displayName = displayName;
        this.iconName = iconName;
    }

    public String getEnumID()
    {
        return enumID;
    }

    public String getDisplayName()
    {
        return displayName;
    }

    public String getIconName()
    {
        return iconName;
    }

    public JPanel getContentPanel()
    {
        return contentPanel;
    }

    public void setContentPanel(JPanel contentPanel)
    {
        this.contentPanel = contentPanel;
    }

    public String toString()
    {
        return displayName;
    }

    // Lists
    public static final List<NavigationEnum> NAVIGATION_SIDEBAR_LINKS = new ArrayList<NavigationEnum>(),
        ACTION_TABS = new ArrayList<NavigationEnum>(),
        MANAGEMENT_TABS = new ArrayList();

    // Initialize lists
    static
    {
        NAVIGATION_SIDEBAR_LINKS.add(ACTION_TAB_CONTAINER);
        NAVIGATION_SIDEBAR_LINKS.add(DONATE);

        MANAGEMENT_VIEW.setContentPanel(new ServerFarmView());
        MESSAGES_VIEW.setContentPanel(new MessagesView());
        MANAGEMENT_TABS.add(MANAGEMENT_VIEW);
        MANAGEMENT_TABS.add(MESSAGES_VIEW);

        ACTION_TABS.add(ACTION_VIEW);
        ACTION_TABS.add(ACTION_EDIT);
        ACTION_TABS.add(ACTION_EXECUTION);

        // Set up content panels
        EMAIL_ME.setContentPanel(new BugReportView(EMAIL_ME.getDisplayName()));
        DONATE.setContentPanel(new DonateView());
        ACTION_VIEW.setContentPanel(new JTransparentPanel());

        MANAGEMENT_TAB_CONTAINER.setContentPanel(ManagementTab.MANAGEMENT_TAB);

        ACTION_TAB_CONTAINER.setContentPanel(ActionTab.ACTION_TAB);
        ACTION_EDIT.setContentPanel(new JTransparentPanel());
    }


}
